frondoc picture
What is Frontier?
Download
News & Updates
Mailing Lists
Sample Scripts
Site Outline
Search
Guestbook
BBS
User's Guide
1 2 3 4 5 6
7 8 9 10 11
Apple File Edit
Main Open Suites
Web Window
Menubar Outline
Script Table WP

Frontier website on www.scripting.com

Droplets

Droplets are double-clickable applications that have an embedded script that runs once for each file, folder or disk icon that's dragged onto the app.

When you launch a droplet, a window appears. Here's what each of the three buttons in the droplet's window does.

To develop your own droplet, copy and paste one of the sub-tables in suites.droplet.tables. Open it, and modify the contents. Provide a Finder comment, version number, write some help text, and of course fill in the script.

To export the droplet script and its related information, be sure that the table window from the previous step is frontmost, and choose Export To App... from the Droplet menu.

How droplet scripts work

When you want to work with droplets, choose "Droplet Developer" from Frontier's Suites menu.

Open the script in the Get File Info table. Here's what it contains:

   if system.droplet.closedown 
      msg ("Get File Info: closing down.")
   if system.droplet.startup 
      msg ("Get File Info: starting up.")
   if file.exists (system.droplet.path) 
      Frontier.bringToFront ()
      dialog.fileInfo (system.droplet.path)

This script is simpler than most droplet scripts, but it illustrates the key points.

The script is run once for every file, folder or disk that's dragged onto the droplet's icon. The first time the script runs, a boolean, system.droplet.startup, is true. This allows you to do any initialization you might need to do.

The name of the file you are being asked to process is in system.droplet.path. You can use the file.isFolder verb to determine if it is a file or a folder, or use file.isVolume to see if a disk icon has been dragged onto your droplet. From there, you can do anything a Frontier script can do -- which is quite a lot!

After all the dragged icons have been processed, your script is called one more time with system.droplet.closedown set true and system.droplet.path set to the empty string. You can clean up after your script, deleting any temporary files or objects you created or closing windows or beeping the speaker. After you are finished closing down, return.

A droplet can have menus. Create a menubar object in the droplet table called menuBar and export it as usual. When you launch the droplet, you'll see the menus in the Mac's menu bar. Your menu doesn't show up if it's a faceless droplet.

To make a droplet faceless, include a boolean in the droplet table called faceless, set its value to true.

New in Frontier 4.1 -- Droplets can contain MacBird cards

If a droplet table contains a binary object named card, and if it's faceless, the card runs.

Download the new version from:

ftp://ftp.scripting.com/userland/dropletDeveloper4.1.sit.hqx

Launch Frontier and double-click on runMeFirst. This script moves the tables in droplet.tables into a user.droplet.tables, which it creates. Now it's safe to run the other scripts. Click on OK for each of the confirmation prompts.

A sample droplet is included -- Add File Sizes. Run it by double-clicking on it, and by dragging a group of files. It ignores folders and disks.

Choose Droplet Developer from the Suites menu to add the Droplets menu to your menu bar. Choose Import From App... and open the Add File Sizes droplet. A table opens. Put the table cursor on the card and press cmd-E to edit it. When MacBird comes to the front, press cmd-E to edit the embedded table.


© Copyright 1996-97 UserLand Software. This page was last built on Wed, Jan 22, 1997 at 3:04:13 PM with Frontier. Thanks for checking it out! Dave